function printFigureA4Multiformat( fig, path, name )
%PRINTFIGUREA4MULTIFORMAT Don't include the extension in name!

% Remove illigal characters..
name([find(name=='/') find(name==';') find(name=='\') find(name=='?') find(name=='*') ]) = '_';
disp(['Exporting to file: ' name]);

saveas(fig, [path name '.fig'])
set(fig, 'PaperUnits', 'centimeters');
set(fig, 'PaperType', 'A4');
set(fig, 'PaperPositionMode', 'manual');
set(fig, 'PaperOrientation', 'landscape');
papersize = get(fig, 'PaperSize');
edge = 1;
myfiguresize = [edge, edge, ...
    papersize(1) - 2*edge, papersize(2) - 2*edge];
set(fig, 'PaperPosition', myfiguresize);
print(['-f' num2str(fig)], [path name '.eps'], '-depsc', '-r600');
print(['-f' num2str(fig)], [path name '.png'], '-dpng', '-r600');
% print(['-f' num2str(fig)], [path name '.pdf'], '-dpdf', '-r600');

end

